#pragma once
#include <iostream>
#include <iomanip>
#include <stdio.h>
#include <vector>
#include <string>

using namespace std;

typedef struct {
	int weight;
	int parent, lchild, rchild;
}HTNode,*HuffmanTree;

void Select(HuffmanTree& HT, int end, int& s1, int& s2);
void CreateHuffmanTree(HuffmanTree& HT, int n);
int CalculateWPL(HuffmanTree HT, int n);